Skip to content

fix: Gray out update transfer interface when updates are disabled#293

Closed
ut005973 wants to merge 1 commit into
masterfrom
develop/dcc-update-plugin-private
Closed

fix: Gray out update transfer interface when updates are disabled#293
ut005973 wants to merge 1 commit into
masterfrom
develop/dcc-update-plugin-private

Conversation

@ut005973

@ut005973 ut005973 commented May 9, 2026

Copy link
Copy Markdown
Contributor

[V25 2500U1][Update Management System][Control Center Update Client][Tenth Round Testing][System Update][Public Network][Control Center][System Update] When checking for updates is turned off, the transfer optimization related configuration items should be grayed out and non-operable

Log: As above
Bug: https://pms.uniontech.com/bug-view-360209.html
Influence: Affects the update transfer interface when updates are disabled

fix: 更新被禁用时更新传递界面置灰
【V25 2500U1】【更新管理系统】【控制中心更新客户端】【第十轮测试】【系统更新】【公网】【控制中心】【系统更新】关闭检查更新,传递优化相关配置项需要置灰不可操作

Log:如上所述
Bug:https://pms.uniontech.com/bug-view-360209.html Influence:影响更新被禁用时更新传递界面

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ut005973

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

[V25 2500U1][Update Management System][Control Center Update Client][Tenth Round Testing][System Update][Public Network][Control Center][System Update] When checking for updates is turned off, the transfer optimization related configuration items should be grayed out and non-operable

Log: As above
Bug: https://pms.uniontech.com/bug-view-360209.html
Influence: Affects the update transfer interface when updates are disabled

fix: 更新被禁用时更新传递界面置灰
【V25 2500U1】【更新管理系统】【控制中心更新客户端】【第十轮测试】【系统更新】【公网】【控制中心】【系统更新】关闭检查更新,传递优化相关配置项需要置灰不可操作

Log:如上所述
Bug:https://pms.uniontech.com/bug-view-360209.html
Influence:影响更新被禁用时更新传递界面
@ut005973 ut005973 force-pushed the develop/dcc-update-plugin-private branch from 736b868 to 67ad8dd Compare May 9, 2026 02:27
@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

代码审查报告

我对提供的 git diff 进行了详细审查,主要涉及 QML 界面代码、C++ 插件代码和翻译文件的修改。以下是我的分析:

1. 语法逻辑分析

QML 部分 (UpdateSetting.qml)

  • 修改了多个控件的 enabled 属性,添加了 !dccData.model().updateProhibited 条件
  • 语法正确,逻辑上确保当更新被禁止时,相关控件会被禁用
  • p2pUpdateSupported() 的 DccObject 中也添加了 enabled: !dccData.model().updateProhibited,这是合理的

C++ 部分 (privatelastoreplugin.cpp)

  • 简单的字符串修改,从 "Private Lastore" 改为 "Private Update"
  • 语法正确,没有逻辑问题

翻译文件

  • 修改了多个翻译文件中的源字符串和翻译
  • 语法格式正确,符合 Qt 翻译文件格式

2. 代码质量评估

优点

  1. 一致性:在多个相关控件上统一添加了 updateProhibited 检查,确保行为一致
  2. 用户体验:将 "Shutdown update" 改为更明确的 "Updates will begin on the next shutdown or restart",提高了用户理解度
  3. 命名改进:将 "Private Lastore" 改为 "Private Update",更准确地描述功能

需要改进的地方

  1. 代码重复!dccData.model().updateProhibited 在多处重复出现,可以考虑:

    • 在 QML 中定义一个属性别名来避免重复
    • 或者创建一个辅助函数来统一检查
  2. 翻译完整性:在英文翻译文件中,<translation type="unfinished"></translation> 表明翻译尚未完成,需要补充完整翻译

3. 代码性能分析

  • 这些修改主要是条件判断和字符串更改,对性能影响极小
  • 没有引入新的计算密集型操作或内存分配
  • QML 中的属性绑定是高效的,不会导致性能问题

4. 代码安全考虑

  1. 输入验证:没有直接的用户输入处理,因此没有输入验证问题

  2. 权限控制:添加的 updateProhibited 检查是一个良好的安全实践,确保在系统禁止更新时,相关功能不可用

  3. 潜在问题

    • 需要确保 dccData.model().updateProhibited 属性在所有情况下都有正确的值
    • 建议添加日志记录,当 updateProhibited 状态改变时记录相关信息,便于调试

5. 建议改进方案

减少代码重复

// 在 UpdateSetting.qml 中添加属性别名
property bool updateAllowed: !dccData.model().updateProhibited

// 然后使用 updateAllowed 替代重复的 !dccData.model().updateProhibited
enabled: !dccData.model().isPrivateUpdate && updateAllowed

完善翻译

确保所有翻译文件中的条目都有完整的翻译,特别是英文翻译文件中的 "unfinished" 条目。

添加状态变化通知

// 在 C++ 模型中,当 updateProhibited 状态改变时发出信号
void setUpdateProhibited(bool prohibited) {
    if (m_updateProhibited != prohibited) {
        m_updateProhibited = prohibited;
        emit updateProhibitedChanged(prohibited);
        qCDebug(LOG) << "Update prohibition status changed to:" << prohibited;
    }
}

总结

整体上,这些修改是合理的,提高了用户界面的清晰度和一致性。主要改进建议集中在减少代码重复和完善翻译上。没有发现明显的安全问题或性能瓶颈。

@ut005973 ut005973 closed this May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants